import { createRouter, createWebHistory,  } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "home",
      component: () => import("@/views/index.vue"),
      meta: {
        keepAlive: true, 
      },
    },
    {
      path: "/login", //登录页
      name: "login",
      component: () => import("@/views/login/index.vue"),
    },
    {
      path: "/changepassword", //修改密码
      name: "changepassword",
      component: () => import("@/views/login/changepassword.vue"),
    },
    {
      path: "/detail", //faq详情页
      name: "detail",
      component: () => import("@/views/category/detail/index.vue"),
      meta: {
        keepAlive: true, 
      },
    },
    {
      path: "/question", //提交问题页
      name: "question",
      component: () => import("@/views/question/index.vue"),
      meta: {
        keepAlive: false, 
      },
    },
    {
      path: "/findaccount", //找回账号
      name: "findaccount",
      component: () => import("@/views/question/findaccount.vue"),
      meta: {
        keepAlive: false,
      },
    },
    {
      path: "/restart", //重新提交问题
      name: "restart",
      component: () => import("@/views/question/restart.vue"),
      meta: {
        keepAlive: false, 
      },
    },
    {
      path: "/order", //服务记录页
      name: "order",
      component: () => import("@/views/order/order.vue"),
      meta: {
        keepAlive: true, // 标记此路由需要缓存
      },
    },
    {
      path: "/order_detail", //服务记录详情
      name: "order_detail",
      component: () => import("@/views/order/detail/order_detail.vue"),
    },
  ],
});

export default router;
